Sets up a synchronizer on a MOD music or file stream channel.
HSYNC WINAPI BASS_ChannelSetSync( |
Parameters
handle | The channel handle... a HMUSIC or HSTREAM. |
type | The type of sync... see the table below. If you want the sync to occur only once, then also use the BASS_SYNC_ONETIME flag. |
param | The sync parameters, depends on the sync type... see the table below. |
proc | The callback function. |
Sync types, with param and SYNCPROC data definitions.
BASS_SYNC_MUSICPOS | Sync when a MOD music reaches a position. param : LOWORD = order (0=first, -1=all), HIWORD = row (0=first, -1=all). data : LOWORD = order, HIWORD = row. |
BASS_SYNC_MUSICINST | Sync when an instrument (sample for the MOD/S3M/MTM formats) is played in a MOD music (not including retrigs). param : LOWORD = instrument (1=first), HIWORD = note (0=c0...119=b9, -1=all). data : LOWORD = note, HIWORD = volume (0-64). |
BASS_SYNC_END | Sync when a MOD music or file stream reaches the end. Note that some MOD musics never reach the end, they may jump to another position first. param : not used. data : not used. |
Return value
If succesful, then the new synchronizer's handle is returned, else 0 is returned. Use BASS_ErrorGetCode to get the error code.
Error codes
BASS_ERROR_HANDLE | handle is not a valid channel. |
BASS_ERROR_ILLPARAM | An illegal param was specified. |
BASS_ERROR_ILLTYPE | An illegal type was specified. |
Remarks
Multiple synchronizers may be used per channel. Use BASS_ChannelRemoveSync to remove a synchronizer. If the BASS_SYNC_ONETIME flag is used, then the sync is automatically removed after it's occured (ie. there's no need to remove it manually).
The channel (ie. MOD music) does not have to be playing to set a synchronizer, you can set synchronizers before or while playing the music. Equally, you can also remove synchronizers at any time.
Example
To do some processing until a MOD music reaches the 10th order.
BOOL order10=FALSE; // the order 10 flag |
See also
BASS_ChannelRemoveSync, SYNCPROC callback